package com.jyb.controller;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.core.Controller;
import com.jyb.model.Jxjh;
import com.jyb.model.QueryLog;
import com.jyb.util.StringUtils;
import com.jyb.vo.UserVo;

public class JxjhController extends Controller{

	public void index(){
		
		String cm=getPara("cm");
		
		List<Jxjh> vos=new ArrayList<Jxjh>();
		if(!StringUtils.isEmpty(cm)){
			cm=cm.trim();
			vos=Jxjh.dao.findListByCm(cm, null);
		}
		
		UserVo userVo=(UserVo)getSession().getAttribute("user");
		if(userVo!=null&&vos.size()>0){
			QueryLog.dao.addOrUpdate(userVo.getId(), "0", cm);
		}
		
		setAttr("cm", cm);
		setAttr("vos", vos);
		
		setAttr("nav", "jxjh");
		renderJsp("/views/jxjh/index.jsp");
	}
}
